"""瀚越包装方案匹配工具主模块初始化"""

import os
import sys
import logging

# 版本信息
__version__ = "1.0.0"

def get_version():
    """获取项目版本号

    Returns:
        str: 项目版本号
    """
    return __version__

# 确保src目录在sys.path中
src_path = os.path.dirname(os.path.abspath(__file__))
if src_path not in sys.path:
    sys.path.insert(0, src_path)

# 显式导入需要的模块内容
try:
    # 配置模块 - 仅导入__all__中列出的内容
    from .config import (
        DATA_VALIDATION_RULES,
        PACKAGE_TYPE,
        MATCH_STATUS,
        FIELD_NAMES,
        REQUIRED_FIELDS,
        HISTORICAL_FIELDS,
        UI_SETTINGS,
        FILE_FORMATS,
        PROCESSING_STAGES,
        CLASSIFICATION_CATEGORIES,
        ITERATIVE_SPLITTING,
        EXPORT_SETTINGS,
        MATCHING_CONFIG,
    )
except ImportError as e:
    logging.error(f"导入配置模块失败: {str(e)}")

try:
    # 工具模块
    from .utils import (
        ExcelUtils,
        LoggingUtils,
        PathUtils,
        MathUtils,
    )
except ImportError as e:
    logging.error(f"导入工具模块失败: {str(e)}")

try:
    # 数据处理模块
    from .data_processing import (
        DataImporter,
        DataMatcher,
        DataPreprocessor,
        ResultProcessor,
    )
except ImportError as e:
    logging.error(f"导入数据处理模块失败: {str(e)}")

try:
    # UI模块
    from .ui import MainWindow
except ImportError as e:
    logging.error(f"导入UI模块失败: {str(e)}")

# 导出内容
__all__ = [
    # 版本信息
    "__version__",
    "get_version",
    # 配置模块
    "DATA_VALIDATION_RULES",
    "PACKAGE_TYPE",
    "MATCH_STATUS",
    "FIELD_NAMES",
    "REQUIRED_FIELDS",
    "HISTORICAL_FIELDS",
    "UI_SETTINGS",
    "FILE_FORMATS",
    "PROCESSING_STAGES",
    "CLASSIFICATION_CATEGORIES",
    "ITERATIVE_SPLITTING",
    "EXPORT_SETTINGS",
    "MATCHING_CONFIG",
    # 数据处理模块
    "DataImporter",
    "DataPreprocessor",
    "DataMatcher",
    "ResultProcessor",
    # 工具模块
    "ExcelUtils",
    "LoggingUtils",
    "PathUtils",
    "MathUtils",
    # UI模块
    "MainWindow",
]
